$(document).ready(function(){
    $(".i-checks").iCheck({
        checkboxClass:"icheckbox_square-green",
        radioClass:"iradio_square-green",
    });

    $("#save").click(function(){
        var name = $.trim($("input[name='name']").val());
        var sex = $.trim($("input[name='sex']:checked").val());
        var phone = $.trim($("input[name='phone']").val());
        var level = $.trim($("input[name='level']").val());
        var userid = $.trim($("input[name='userid']").val());
        var pid = $.trim($("input[name='pid']").val());



        if(userid == ''){
            layer.msg("请填写用户ID");
            return false;
        }

        if(pid == ''){
            layer.msg("请填写PID");
            return false;
        }

        if(level == ''){
            layer.msg("请填写level");
            return false;
        }

        $.ajax({
            'url': GV.member_editmember,
            'type':'post',
            'data':{'userid':userid,'pid':pid,'level':level},
            success:function(data){
                console.log(data);
                if(data.status == 1){
                    layer.msg(data.info);
                    setTimeout(function(){
                        location.href = data.url;
                    },1000);
                }else{
                    layer.msg(data.info);
                    location.href = data.url;
                }
            }
        });
    });
});